#include <iostream>
#include <future>

using namespace std;

int Add(int a,int b)
{
    cout << "into Add" << endl;
    return a + b;
}

int main()
{
    //启动线程异步调用Add对象
    std::future<int> f = std::async(std::launch::async,Add,1,2);

    //测试和主线程是异步操作
    cout << "——————————————————————" << endl;
    cout << f.get() << endl;
    return 0;
}

